Page({
  data: {
    videoInfo: null,
    loading: true
  },

  onLoad(options) {
    const id = options.id
    // TODO: 根据id获取视频详情
    this.setData({
      videoInfo: {
        id: id,
        title: '非遗里的雅安-宋经杨氏小架48式太极拳',
        videoUrl: 'https://example.com/video.mp4',
        coverUrl: '/static/images/video-cover1.jpg',
        source: '雅安市文化馆',
        description: '宋经杨氏小架48式太极拳是雅安市非物质文化遗产，由宋经杨先生创编，具有独特的技术特点和文化价值。'
      },
      loading: false
    })
  },

  // 返回上一页
  onBack() {
    wx.navigateBack()
  },

  // 分享视频
  onShareAppMessage() {
    const { videoInfo } = this.data
    return {
      title: videoInfo.title,
      path: `/pages/video/play?id=${videoInfo.id}`
    }
  }
})